/*
** my_getnbr.c for  in /home/jousse_f//afs/rendu/piscine/Jour_04
** 
** Made by florian jousseau
** Login   <jousse_f@epitech.net>
** 
** Started on  Tue Oct 12 10:02:36 2010 florian jousseau
** Last update Tue Oct 12 11:13:28 2010 florian jousseau
*/

int	my_getnbr(char *str)
{
  int	 count;
  int	 s;
  int	 nbr;

  s = 1;
  count = 0;
  while (str[count] != '\0' && (str[count] == '+' || str[count] == '-'))
    {
      if (str[count] == '-')
	{
	  s = s * -1;
	}
      count = count + 1;
    }
  str = str + count;
  nbr = 0;
  count = 0;
  while (str[count] >= '0' && str[count] <= '9')
    {
      nbr = nbr * 10;
      nbr = nbr - (str[count] - '0');
      count = count + 1;
    }
  return (nbr * s * -1);
}
